package com.sinsoft.monitorDemo.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sinosoft.framework.core.common.utils.ajax.ResponseData;
import com.sinsoft.monitorDemo.dao.MysqlInfoDao;
import com.sinsoft.monitorDemo.entity.MysqlInfo;

@Controller
@RequestMapping("/mysqlInfo")
public class MysqlInfoController {
	
	@RequestMapping(value = "/getMysqlinfoList", method = RequestMethod.POST)
	@ResponseBody
	public ResponseData getMysqlinfoList(HttpServletRequest request){
		MysqlInfoDao dao = new MysqlInfoDao();
		String ip = request.getParameter("ip");
		List<MysqlInfo> mysqlInfo = dao.getMysqlInfoList(ip);
		ResponseData responseData = new ResponseData(true, mysqlInfo);
		return responseData;	
	}
	
	
	@RequestMapping(value = "/getNewMysqlinfo", method = RequestMethod.POST)
	@ResponseBody
	public ResponseData getNewMysqlinfo(HttpServletRequest request){
		MysqlInfoDao dao = new MysqlInfoDao();
		String ip = request.getParameter("ip");
		MysqlInfo newMysqlInfo = dao.getNewMysqlInfo(ip);
		ResponseData responseData = new ResponseData(true, newMysqlInfo);
		return responseData;	
	}
}
